<template>
<div>
  <a href="/#/home">首页</a>&nbsp;&nbsp;
  <a href="/#/movie">电影</a>&nbsp;&nbsp;
  <a href="/#/about">关于</a>
  <component :is="comName"></component>
</div>
 
</template>

<script>
import MyAbout from './components/MyAbout.vue'
import MyHome from './components/MyHome.vue'
import MyMovie from './components/MyMovie.vue'
export default {
  components: { MyHome, MyMovie, MyAbout },
  data () {
    return {
      comName:'MyHome'
    }
  },
  created() {
    window.addEventListener('hashchange',()=>{
      if (location.hash === '#/home') {
        this.comName = 'MyHome'
      }
         if (location.hash === '#/movie') {
        this.comName = 'MyMovie'
      }
         if (location.hash === '#/about') {
        this.comName = 'MyAbout'
      }
    })
  },
}
</script>

<style>

</style>